<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('goods_brand_id')->comment("品牌id");
            $table->unsignedInteger('goods_category_id')->comment("商品分类id");
            $table->string('title')->comment("标题");
            $table->string('sub_title')->comment("副标题");
            $table->string('goods_num')->comment("商品编号");
            $table->string('unit',100)->comment('单位');
            $table->char('keywords')->comment('关键词');
            $table->unsignedInteger('sku_id')->comment("商品默认的skuid");
            $table->tinyInteger("is_show_stock")->default(0)->comment("是否显示库存：1显示，0不显示");
            $table->unsignedInteger("stock")->default(0)->comment("库存");
            $table->string('image',100)->comment('默认图');
            $table->string('carousel_image',200)->comment('商品轮播图');
            $table->text('description')->comment("商品详情")->nullable();
            $table->tinyInteger("status")->default(0)->comment("状态 0上架，1下架，2删除");
            $table->tinyInteger("recommend")->default(0)->comment("是否推荐 0否 1是");
            $table->dateTime('production_time')->nullable()->comment("生产日期");

            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods');
    }
}
